import QtQuick 1.1
import com.nokia.meego 1.0
//import com.nokia.symbian 1.0

Dialog {
    id: dialog
    property alias model: list.model
    title: /*Label{*/ Text {
        id: titleField
        horizontalAlignment: Text.AlignHCenter
        width: parent.width
        height: 50
        text: "High Scores"
        color: "white"
        font.pixelSize: 28
    }

    buttons: ButtonRow {
        id: buttonField
        anchors.horizontalCenter: parent.horizontalCenter
        Button {
            text: "Close"
            onClicked: {
                console.log("model.count", list.model.count, "listView hight:", list.height)
                dialog.close()
            }
        }
    }

    content: ListView {
        id: list
        property int __sizeHint: visualParent ? visualParent.height - titleField.height - buttonField.height - 64
                                              : root.parent.height - titleField.height - buttonField.height - 64

        height: __sizeHint/*Math.min(__sizeHint, 50*model.count)*/
        clip:false
        width: dialog.width
        delegate: Item {
            height: 50
            width: parent.width
            Text {
                id: text
                anchors.centerIn: parent
                horizontalAlignment: Text.AlignHCenter
                width:parent.width
                height: 50
                font.pixelSize: 22
                color: "white"
                text: name + ":" + score
            }
        }
        model: listModel
        ListModel {
            id: listModel
        }
    }
}
